<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <style>
    *{
      margin: 0;
      padding: 0;
      list-style: none;
      vertical-align: middle;
    }
    .box{
      position: fixed;
      right: 0;
      bottom: 0;
    }
    span{
      position: absolute;
      right: 10px;
      width: 20px;
      height: 20px;
      cursor: pointer;
    }
  </style>
</head>
<body>
  <div class="box">
    <div class="top">
      <span class="close"></span>
      <img src="images/t.jpg" alt="">
    </div>
    <div class="bottom">
      <img src="images/b.jpg" alt="">
    </div>
  </div>
  <script src="../../jquery-1.12.4.min.js"></script>
  <script>
    $('.close').click(function(){
      $('.bottom').animate({
        height:0,
      },2000,'linear',function(){
        $('.box').animate({
          width:0,
        },2000,'swing',function(){
          //当所有运动都完毕了，使用DOM的方式将box移除。 (DOM方法：父元素.removeChild(要移除的子元素))
          //运动完毕后，删除box - 将jQuery对象转换为DOM对象再进行删除(1.get()方法 2.直接索引的方法)
          //方法一
          document.querySelector('body').removeChild($('.box').get(0));
          //方法二
          document.querySelector('body').removeChild($('.box')[0]);
          //方法三
          document.body.removeChild($('.box')[0]);
        });
      });
    });
  </script>
</body>
</html>